#!/usr/bin/make -f
#
# Jailhouse, a Linux-based partitioning hypervisor
#
# Copyright (c) Vijai Kumar K, 2020
#
# Authors:
#  Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
#
# SPDX-License-Identifier: MIT
#

ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
SET_CROSS_BUILD_TOOLS=CROSS_BUILD_TOOLS=y
endif

override_dh_auto_build:
	$(MAKE) $(PARALLEL_MAKE) $(U_BOOT_CONFIG)
	$(MAKE) $(PARALLEL_MAKE) $(U_BOOT_BIN) \
		BL31=/usr/lib/trusted-firmware-a/pine64-plus/bl31.bin
	$(MAKE) $(PARALLEL_MAKE) $(SET_CROSS_BUILD_TOOLS) NO_SDL=1 envtools

override_dh_auto_install:
	mv tools/env/lib.a tools/env/libubootenv.a

override_dh_auto_test:

%:
	CFLAGS= LDFLAGS= dh $@ --parallel
